package com.geekathon.mobzilla.model;

import java.util.Date;
import java.util.List;

import com.google.gson.annotations.SerializedName;

public class Bug {

	@SerializedName("actual_time")
	private Double actualTime;

	@SerializedName("alias")
	String alias;

	@SerializedName("assigned_to")
	private User assignedTo;

	@SerializedName("attachments")
	private List<Attachment> attachments;

	@SerializedName("blocks")
	private List<Integer> blocks;

	@SerializedName("cc")
	private List<User> cc;

	@SerializedName("classification")
	private String classification;

	@SerializedName("comments")
	private List<Comment> comments;

	@SerializedName("component")
	private String component;

	@SerializedName("creation_time")
	private Date creationTime;

	@SerializedName("creator")
	private User creator;

	@SerializedName("deadline")
	private Date deadline;

	@SerializedName("depends_on")
	private List<Integer> dependsOn;

	@SerializedName("dupe_of")
	private Integer dupeOf;

	@SerializedName("estimated_time")
	private Double estimatedTime;

	@SerializedName("flags")
	private List<Flag> flags;

	@SerializedName("groups")
	private List<Group> groups;

	@SerializedName("history")
	private List<ChangeSet> history;

	@SerializedName("id")
	private Integer id;

	@SerializedName("is_cc_accessible")
	private Boolean isCCAccessible;

	@SerializedName("is_confirmed")
	private Boolean isConfirmed;

	@SerializedName("is_creator_accessible")
	private Boolean isCreatorAccessible;

	@SerializedName("keywords")
	private List<String> keywords;

	@SerializedName("last_change_time")
	private Date lastChangeTime;

	@SerializedName("op_sys")
	private String opSys;

	@SerializedName("platform")
	private String platform;

	@SerializedName("priority")
	private String priority;

	@SerializedName("product")
	private String product;

	@SerializedName("qa_contact")
	private User qaContact;

	@SerializedName("ref")
	private String ref;

	@SerializedName("remaining_time")
	private Double remainingTime;

	@SerializedName("resolution")
	private String resolution;

	@SerializedName("see_also")
	private List<String> seeAlso;

	@SerializedName("severity")
	private String severity;

	@SerializedName("status")
	private String status;

	@SerializedName("summary")
	private String summary;

	@SerializedName("target_milestone")
	private String targetMilestone;

	@SerializedName("update_token")
	private String updateToken;

	@SerializedName("url")
	private String url;

	@SerializedName("version")
	private String version;

	@SerializedName("whiteboard")
	private String whiteboard;

	@SerializedName("work_time")
	private Double workTime;

	public Double getActualTime() {
		return actualTime;
	}

	public void setActualTime(Double actualTime) {
		this.actualTime = actualTime;
	}

	public String getAlias() {
		return alias;
	}

	public void setAlias(String alias) {
		this.alias = alias;
	}

	public User getAssignedTo() {
		return assignedTo;
	}

	public void setAssignedTo(User assignedTo) {
		this.assignedTo = assignedTo;
	}

	public List<Attachment> getAttachments() {
		return attachments;
	}

	public void setAttachments(List<Attachment> attachments) {
		this.attachments = attachments;
	}

	public List<Integer> getBlocks() {
		return blocks;
	}

	public void setBlocks(List<Integer> blocks) {
		this.blocks = blocks;
	}

	public List<User> getCc() {
		return cc;
	}

	public void setCc(List<User> cc) {
		this.cc = cc;
	}

	public String getClassification() {
		return classification;
	}

	public void setClassification(String classification) {
		this.classification = classification;
	}

	public List<Comment> getComments() {
		return comments;
	}

	public void setComments(List<Comment> comments) {
		this.comments = comments;
	}

	public String getComponent() {
		return component;
	}

	public void setComponent(String component) {
		this.component = component;
	}

	public Date getCreationTime() {
		return creationTime;
	}

	public void setCreationTime(Date creationTime) {
		this.creationTime = creationTime;
	}

	public User getCreator() {
		return creator;
	}

	public void setCreator(User creator) {
		this.creator = creator;
	}

	public Date getDeadline() {
		return deadline;
	}

	public void setDeadline(Date deadline) {
		this.deadline = deadline;
	}

	public List<Integer> getDependsOn() {
		return dependsOn;
	}

	public void setDependsOn(List<Integer> dependsOn) {
		this.dependsOn = dependsOn;
	}

	public Integer getDupeOf() {
		return dupeOf;
	}

	public void setDupeOf(Integer dupeOf) {
		this.dupeOf = dupeOf;
	}

	public Double getEstimatedTime() {
		return estimatedTime;
	}

	public void setEstimatedTime(Double estimatedTime) {
		this.estimatedTime = estimatedTime;
	}

	public List<Flag> getFlags() {
		return flags;
	}

	public void setFlags(List<Flag> flags) {
		this.flags = flags;
	}

	public List<Group> getGroups() {
		return groups;
	}

	public void setGroups(List<Group> groups) {
		this.groups = groups;
	}

	public List<ChangeSet> getHistory() {
		return history;
	}

	public void setHistory(List<ChangeSet> history) {
		this.history = history;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Boolean getIsCCAccessible() {
		return isCCAccessible;
	}

	public void setIsCCAccessible(Boolean isCCAccessible) {
		this.isCCAccessible = isCCAccessible;
	}

	public Boolean getIsConfirmed() {
		return isConfirmed;
	}

	public void setIsConfirmed(Boolean isConfirmed) {
		this.isConfirmed = isConfirmed;
	}

	public Boolean getIsCreatorAccessible() {
		return isCreatorAccessible;
	}

	public void setIsCreatorAccessible(Boolean isCreatorAccessible) {
		this.isCreatorAccessible = isCreatorAccessible;
	}

	public List<String> getKeywords() {
		return keywords;
	}

	public void setKeywords(List<String> keywords) {
		this.keywords = keywords;
	}

	public Date getLastChangeTime() {
		return lastChangeTime;
	}

	public void setLastChangeTime(Date lastChangeTime) {
		this.lastChangeTime = lastChangeTime;
	}

	public String getOpSys() {
		return opSys;
	}

	public void setOpSys(String opSys) {
		this.opSys = opSys;
	}

	public String getPlatform() {
		return platform;
	}

	public void setPlatform(String platform) {
		this.platform = platform;
	}

	public String getPriority() {
		return priority;
	}

	public void setPriority(String priority) {
		this.priority = priority;
	}

	public String getProduct() {
		return product;
	}

	public void setProduct(String product) {
		this.product = product;
	}

	public User getQaContact() {
		return qaContact;
	}

	public void setQaContact(User qaContact) {
		this.qaContact = qaContact;
	}

	public String getRef() {
		return ref;
	}

	public void setRef(String ref) {
		this.ref = ref;
	}

	public Double getRemainingTime() {
		return remainingTime;
	}

	public void setRemainingTime(Double remainingTime) {
		this.remainingTime = remainingTime;
	}

	public String getResolution() {
		return resolution;
	}

	public void setResolution(String resolution) {
		this.resolution = resolution;
	}

	public List<String> getSeeAlso() {
		return seeAlso;
	}

	public void setSeeAlso(List<String> seeAlso) {
		this.seeAlso = seeAlso;
	}

	public String getSeverity() {
		return severity;
	}

	public void setSeverity(String severity) {
		this.severity = severity;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	public String getTargetMilestone() {
		return targetMilestone;
	}

	public void setTargetMilestone(String targetMilestone) {
		this.targetMilestone = targetMilestone;
	}

	public String getUpdateToken() {
		return updateToken;
	}

	public void setUpdateToken(String updateToken) {
		this.updateToken = updateToken;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public String getWhiteboard() {
		return whiteboard;
	}

	public void setWhiteboard(String whiteboard) {
		this.whiteboard = whiteboard;
	}

	public Double getWorkTime() {
		return workTime;
	}

	public void setWorkTime(Double workTime) {
		this.workTime = workTime;
	}
	
	/*public Bug()
	{
		assignedTo = new User();
		attachments = new ArrayList<Attachment>();
		comments = new ArrayList<Comment>();
		
		creationTime = new Date();
		
		creator = new User();
		qaContact = new User();
	}*/
	
	
	private String getCommentsString()
	{
		if(getComments() == null || getComments().size() == 0)
		{
			return "";
		}
		
		String ret = "Comments : ";
		
		for(Comment c : getComments())
		{
			ret = ret + "\t" + c.toString();
		}
		
		return ret;
	}
	
	private String getAttachmentsString()
	{
		if(getAttachments()== null || getAttachments().size() == 0)
		{
			return "";
		}
		
		String ret = "Attachments : ";
		
		for(Attachment a : getAttachments())
		{
			ret = ret + "\t" + a.toString() + "\n\n";
		}
		
		return ret;
	}

	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Bug[");
		builder.append("actualTime = ").append(actualTime);
		builder.append(" assignedTo = ").append(assignedTo);
		builder.append(" attachments = ").append(attachments);
		builder.append(" blocks = ").append(blocks);
		builder.append(" cc = ").append(cc);
		builder.append(" classification = ").append(classification);
		builder.append(" comments = ").append(comments);
		builder.append(" component = ").append(component);
		builder.append(" creationTime = ").append(creationTime);
		builder.append(" creator = ").append(creator);
		builder.append(" deadline = ").append(deadline);
		builder.append(" dependsOn = ").append(dependsOn);
		builder.append(" dupeOf = ").append(dupeOf);
		builder.append(" estimatedTime = ").append(estimatedTime);
		builder.append(" flags = ").append(flags);
		builder.append(" groups = ").append(groups);
		builder.append(" history = ").append(history);
		builder.append(" id = ").append(id);
		builder.append(" isCCAccessible = ").append(isCCAccessible);
		builder.append(" isConfirmed = ").append(isConfirmed);
		builder.append(" isCreatorAccessible = ").append(isCreatorAccessible);
		builder.append(" keywords = ").append(keywords);
		builder.append(" lastChangeTime = ").append(lastChangeTime);
		builder.append(" opSys = ").append(opSys);
		builder.append(" platform = ").append(platform);
		builder.append(" priority = ").append(priority);
		builder.append(" product = ").append(product);
		builder.append(" qaContact = ").append(qaContact);
		builder.append(" ref = ").append(ref);
		builder.append(" remainingTime = ").append(remainingTime);
		builder.append(" resolution = ").append(resolution);
		builder.append(" seeAlso = ").append(seeAlso);
		builder.append(" severity = ").append(severity);
		builder.append(" status = ").append(status);
		builder.append(" summary = ").append(summary);
		builder.append(" targetMilestone = ").append(targetMilestone);
		builder.append(" updateToken = ").append(updateToken);
		builder.append(" url = ").append(url);
		builder.append(" version = ").append(version);
		builder.append(" whiteboard = ").append(whiteboard);
		builder.append(" workTime = ").append(workTime);
		builder.append("]");
		return builder.toString();
	}
}